import request from '@/config/axios'

// 分页
export const getPage = async (params: any) => {
  return await request.get({ url: `/promotion/gift/activity/page`, params })
}

// 列表
export const getListByIds = async (ids: any[]) => {
  if (!ids?.length) {
    ids = [0]
  }
  return await request.get({ url: `/promotion/gift/activity/list?ids=` + ids })
}

// 列表（供选择）
export const getListForPick = async () => {
  return await request.get({ url: `/promotion/gift/activity/list-for-pick` })
}

// 详情
export const getDetailById = async (id: number | string) => {
  return await request.get({ url: `/promotion/gift/activity/get/` + id })
}

// 创建
export const create = async (data: any) => {
  return await request.post({ url: `/promotion/gift/activity/create`, data })
}

// 修改
export const updateById = async (data: any) => {
  return await request.post({ url: `/promotion/gift/activity/update`, data })
}

// 删除
export const deleteById = async (id: number | string) => {
  return await request.post({ url: `/promotion/gift/activity/delete/` + id })
}
